﻿Shader "ztgame/Unlit/T_byxh"
{
	Properties
	{
		_TintColor ("Color", Color) = (0.5,0.5,0.5,1)
		_noise_power ("noise_power", Range(0, 1)) = 0
		_noise ("noise", 2D) = "white" {}
		_tex ("tex", 2D) = "white" {}
	}
	SubShader
	{
		Tags { 
			"IgnoreProjector"="True"
			"Queue"="Transparent"
            "RenderType"="Transparent"
			 }
		LOD 100

		Pass
		{
			Name "FORWARD"
            Tags {
                "LightMode"="ForwardBase"
            }
            Blend One One
            Cull Off
            ZWrite Off
			
			CGPROGRAM
			#pragma vertex vert
			#pragma fragment frag
			
			#include "UnityCG.cginc"

			struct appdata
			{
				float4 vertex : POSITION;
				float2 uv : TEXCOORD0;
				float4 vertexColor : COLOR;
			};

			struct v2f
			{
				float2 uv : TEXCOORD0;
				float2 noiseuv : TEXCOORD1;
				float4 vertex : SV_POSITION;
				float4 vertexColor : COLOR;
			};

			float4 _TintColor;
			float _noise_power;
			sampler2D _noise;	float4 _noise_ST;
			sampler2D _tex;	float4 _tex_ST;


			
			v2f vert (appdata v)
			{
				v2f o;
				o.vertex = UnityObjectToClipPos(v.vertex);
				o.uv = TRANSFORM_TEX(v.uv, _tex);
				o.noiseuv=TRANSFORM_TEX(v.uv, _noise);
				o.vertexColor = v.vertexColor;
				return o;
			}

			
			fixed4 frag (v2f i) : SV_Target
			{
				fixed4 noiseCol=tex2D(_noise,i.noiseuv);
				fixed2 texuv=i.uv+noiseCol.rg*_noise_power;
				fixed4 col = tex2D(_tex, texuv);
				return col*_TintColor*_TintColor.a*i.vertexColor.a;
			}
			ENDCG
		}
	}
}
